package com.kuang.dao;

import com.kuang.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    //注解开发
    @Select("select * from `user`")
    List<User> getUsers();

    //多个基础类型要使用@Param("id")
    @Select("select * from `user` where id = #{id}")
    User getUserByID(@Param("id") int id);

    @Insert("insert into `user`(`id`,`name`,`pwd`) values(#{id},#{name},#{pwd})")
    int addUser3(User user);

    @Update("update `user` set `name`=#{name},`pwd`=#{pwd} where `id`=#{id}")
    int updateUser2(User user);

    @Delete("delete from `user` where `id` = #{id}")
    int deleteUser2(@Param("id") int id);

    List<User> getUserLike(String value);

    //查询全部用户
    List<User> getUserList();

    //根据ID查询用户
    User getUserById(int id);

    User getUserById2(Map<String,Object> map);

    //分页
    List<User> getUserByLimit(Map<String,Integer> map);

    //分页2
    List<User> getUserByRowBounds();

    //insert一个用户
    int addUser(User user);

    int addUser2(Map<String,Object> map);

    //修改用户
    int updateUser(User user);

    //删除用户
    int deleteUser(int id);
}
